<template>
	<van-config-provider :theme="theme">
		<div class="t-container">
			<router-view v-slot="{ Component }">
				<keep-alive>
					<component :is="Component" />
				</keep-alive>
			</router-view>
		</div>
	</van-config-provider>
</template>

<script setup>
import { useStore } from "vuex";
import { computed, onMounted, watch } from "vue";
const store = useStore();

const theme = computed(() => store.state.app.theme);

watch(theme, val => {
	document.body.setAttribute("class", "van-theme-" + val);
});
onMounted(() => {
	document.body.setAttribute("class", "van-theme-" + theme.value);
});
</script>
